# -*- coding: utf-8 -*-
from .base import BaseTool
from .base import PrintUtils,CmdTask,FileUtils,AptUtils,ChooseTask
from .base import osversion,osarch
from .base import run_tool_file

class Tool(BaseTool):
    def __init__(self):
        self.name = "一键安装Vscode"
        self.type = BaseTool.TYPE_INSTALL
        self.autor = 'xxrz'

    def install_vscode(self):
        """
        https://az764295.vo.msecnd.net
        https://az764295.vo.msecnd.net
        """
        # PrintUtils.print_info("开始根据系统架构,为你下载对应版本的vscode~")
        # # 根据系统架构下载不同版本的安装包
        # if osarch=='amd64':
        #     CmdTask('sudo wget http://vscode.cdn.azure.cn/stable/6261075646f055b99068d3688932416f2346dd3b/code_1.73.1-1667967334_amd64.deb -O /tmp/vscode.deb',os_command=True).run()
        # elif osarch=='arm64':
        #     CmdTask('sudo wget http://vscode.cdn.azure.cn/stable/6261075646f055b99068d3688932416f2346dd3b/code_1.73.1-1667966450_arm64.deb -O /tmp/vscode.deb',os_command=True).run()
        # else:
        #     return False
        # PrintUtils.print_info("下载完成,接下来为你安装Vscode~")
        PrintUtils.print_info("开始安装Vscode~")
        CmdTask("sudo dpkg -i ~/autoware/Software/code_1.72.2-1665614327_amd64.deb").run()
        # CmdTask("rm -rf /tmp/vscode.deb").run()
        PrintUtils.print_info("安装完成~")

    def run(self):
        self.install_vscode()

